Skip to content

Portal Client: Improve node status log #3327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 26, 2025

Conversation

bhartnett
Copy link
Contributor

@bhartnett bhartnett commented May 24, 2025

I noticed that in the Nimbus Portal fleet logs the Portal node status looks like this for the 2GB nodes:

INF 2025-05-24 14:34:21.128+00:00 Portal node status                         radiusPercentage=0% radius=4beec975f622c1fd982e0cbef253deb9762ad0e437106ab1ca5f1b5a268139 dbSize=2000236kb

And like this for the 35G nodes:

INF 2025-05-24 14:34:20.341+00:00 Portal node status                         radiusPercentage=1% radius=383355a2cc74296f8485be9e5e43df32638ec2db05c9cd99a365bb2384cdc93 dbSize=35000209kb

Using the default storage size of 2G the radiusPercentage shows as 0%. This isn't very useful information for the user and the radius is actually likely to get smaller as the amount of data in the network grows.

To improve the logs I suggest we use log radius and log radius percent which will be a better way to represent the information. We could either show both the radiusPercentage and logRadiusPercentage or just show the log radius named as radiusPercentage (log base 2).

Also now showing the storage in MB instead of KB.

The updated log looks like this:

INF 2025-05-24 22:30:51.773+08:00 Portal node status                         dbSize=0MB logRadiusPercentage=50% logRadius=128 radiusPercentage=0% radius=ffffffffffffffffffffffffffffffff

Alternatively we could show something like:

INF 2025-05-24 22:30:51.773+08:00 Portal node status                         dbSize=0MB logRadius=128/256 radiusPercentage=0% radius=ffffffffffffffffffffffffffffffff

radius = n.contentDB.dataRadius
radiusPercentage = radius div (UInt256.high() div u256(100))
logRadius = logDistance(radius, u256(0))
logRadiusPercentage = (logRadius * 100) div 256
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree that showing the rounded down 0% is not very useful (hence also the original float precision TODO above), I do not think that showing the log radius percentage is any more useful to an user at all. Regular users have to understand log distance to know what this means, and even then, expressing it as a percentage is not so intuitive I think.
And for devs, I think the logRadius is handy, but from that you can deduct quite immediately the rest and do not need logRadiusPercentage.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree that showing the rounded down 0% is not very useful (hence also the original float precision TODO above), I do not think that showing the log radius percentage is any more useful to an user at all. Regular users have to understand log distance to know what this means, and even then, expressing it as a percentage is not so intuitive I think. And for devs, I think the logRadius is handy, but from that you can deduct quite immediately the rest and do not need logRadiusPercentage.

After thinking about this a bit more I generally agree. Unfortunately, showing the U256 number as a float isn't currently supported by our libraries and I didn't find an easy solution. Even if we get it working, the decimals may be very small because we will eventually end up having very large amount of data in portal network. I think we should show the logRadius like this: radius / 256. Perhaps it could be named different to logRadius or perhaps it could go in a separate debug log since its not ideal for end users. My thoughts are that it doesn't matter too much and would be useful to just see the logRadius here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now removed the logRadiusPercentage field and moved the logRadius field to the last position which should be the least visible. Now that I think about it the existing radius field is not very useful for an end user either (not suggesting we remove it though) and I noticed that in the help when we set the radius using the static option we set it using a log radius value. See from the help:

 --radius                  Radius configuration for the portal node. Radius can be either `dynamic` where
                               the node adjusts the radius based on `storage-size` option, or
                               `static:<logRadius>` where the node has a hardcoded logarithmic radius value.
                               Warning: `static:<logRadius>` disables `storage-size` limits and makes the node
                               store a fraction of the network based on set radius. [=Dynamic].

So considering that logRadius is an end user setting on the CLI perhaps its ok to be in the logs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I'm perfectly fine with having logRadius in there.

@bhartnett bhartnett merged commit 61d7742 into master May 26, 2025
9 of 10 checks passed
@bhartnett bhartnett deleted the portal-improve-node-status-log branch May 26, 2025 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants